package org.xxpay.service.common.util;


import org.jasypt.util.text.BasicTextEncryptor;
import org.xxpay.core.common.constant.MchConstant;

public class DBPasswordUtil {

    public static void main(String[] args) {

        BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor();
        basicTextEncryptor.setPassword(MchConstant.DB_PASSWORD_DECRYPT_KEY);  //设置秘钥

        String[] encryts = new String[]{"xxpay4prodb", "GGESYS4KaaLC228j"};

        String[] decrypts = new String[]{"O9Sf8BHR1lHxRl+gsb1s7xpJnDnXOVr3", "iKasBOSCim6kgqfSg253KHbx2zErndNwm3djpOhU+hQ="};

        try {
            System.out.println("加密结果： ");
            for(int i = 0; i < encryts.length; i++) {
                System.out.println(encryts[i] + " -> " + basicTextEncryptor.encrypt(encryts[i]));
            }
        } catch (Exception e) {
            System.out.println("加密失败！！！！！");
        }

        try {
            System.out.println("解密结果： ");
            for(int i = 0; i < decrypts.length; i++) {
                System.out.println(decrypts[i] + " -> " + basicTextEncryptor.decrypt(decrypts[i]));
            }
        } catch (Exception e) {
            System.out.println("解密失败！！！！！");
        }

    }

}
